<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>计算器</title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			<input type="text" v-model.number="num1"><br>
			<input type="text" v-model.number="num2"><br>
			<button @click="add">计算</button><br>
			总和为:{{result}}
		</div>
		<script>
			let vm = new Vue({
				el: '#app',
				data: {
					num1: '',
					num2: '',
					result: ''
				},
				methods: {
					add() {
                      // this.result=parseInt(this.num1)+parseInt(this.num2);
					  this.result=this.num1+this.num2;
					}
				}
			});
		</script>
	</body>
</html>
